package acm;

import java.util.Scanner;

public class 出现次数最多的整数 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        if (n > 0 & n <= 20) {
            int[] a = new int[n];
            int[] xb = new int[n];
            int m = 0, j, i;
            for (i = 0; i < n; i++) {
                int sr = in.nextInt();
                for (j = 0; j < m; j++) {
                    if (sr == a[j]) {
                        break;
                    }
                }
                if (j == m) {
                    a[m] = sr;
                    xb[m]++;
                    m++;
                } else {
                    for (int x = 0; x < m; x++) {
                        if (sr == a[x]) {
                            xb[x]++;
                        }
                    }
                }
            }
            int max = xb[0], maxs = a[0];
            for (int y = 0; y < m; y++) {
                if (xb[y] > max) {
                    max = xb[y];
                    maxs = a[y];
                }
            }
            System.out.print(maxs);
        }
    }
}
